package org.gl.android.utils;

import java.util.HashSet;
import java.util.Set;

import org.gl.GlobalVariable;
import org.gl.utils.AppConfig;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SharePreferencesUtil {

	public static HashSet<String> getStringSet(String key) {
		SharedPreferences configSharedPreferences = getConfigSharedPreferences();
		return (HashSet<String>) configSharedPreferences.getStringSet(key, new HashSet<String>());
	}
	
	public static boolean AddStringSet(String key,Set<String> values) {
		SharedPreferences configSharedPreferences = getConfigSharedPreferences();
		Editor edit = configSharedPreferences.edit();
		edit.putStringSet(key, values);
		return edit.commit();
	}
	public static SharedPreferences getConfigSharedPreferences() {
		SharedPreferences configSharedPreferences = GlobalVariable.applicationContext
				.getSharedPreferences(AppConfig.SharedPreferencesXML_NAME, 0);
		return configSharedPreferences;
	}

}
